var typeList = null;
var navList;
var textList;
$(function(){ 
	navList = new NavList({				//初始化左边导航
		id:'navBox',
		moveRight:function(){			//向右事件
			textList.setFocus();
		},
		onclick:function(data,id){
			$('#nav').html(data.name);
			if(data.dataList){
				textList.setDataList(data.dataList);
			}else{
				loadDataList(data,afterLoadDataList);
			}
		},
	});
	
	
	textList = new TextList({			//初始化右边导航
		id:'listBox',
		moveLeft:function(){
			navList.setFocus();
		},
		formatHtml:function(data,id){
			var con = '';
			var con =  '<div class="_textListNum">'+id+'</div><div class="_textListName"><a href="#" id="'+this.target+'-a-'+id+'">'+data.name+'</a></div>';
			return con;
		},
		onfocus:function(data,id){
			$.log('on focus item');
		},
		onclick:function(data,id){
			$.log($.toJSON(data));
		}
	}); 
	
	typeList = initData();
	navList.setDataList(typeList,true);
	navList.Click(1);
});

function afterLoadDataList(data,list){
	data.dataList = list;
	textList.setDataList(data.dataList);
}



